<html>
<head>
<script>
		
			var req = new XMLHttpRequest();
		
			var t4lService = "http://talk4link.appspot.com/talk4link/userAgent?";
			var currentUrl = "";
			chrome.tabs.getSelected(null,function(tab) {
					doPost(tab.url);
			});
			
			function doPost(_url){
				var urlReqAjax = t4lService + "u=" + escape(_url); 
				console.log( urlReqAjax );
				req.open(
				    "POST",
				    urlReqAjax 
						, true);
				req.onload = showResult;
				req.send(null);
			}

			function showResult( ){
				var responseJson = eval( "("+ req.responseText + ")");
				if( responseJson.status == 'OK' ){
					document.getElementById("url").innerHTML = responseJson.msg;					
				}else{
					document.getElementById("url").innerHTML = responseJson.msg;
				}
			}
		</script>
</head>
<body>
<div id="url" />
</body>
</html>
